home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 701-725 / 713 / free / free.doc < prev    next >
Text File  |  1995-03-18  |  7KB  |  224 lines

  1. FREE:        Display free space on your mounted disk volumes.
  2.  
  3. Author:        Daniel J. Barrett, barrett@cs.umass.edu.
  4.         April, 1990.  Updated July 1992.
  5.         Inspired by "Free" by Tom Smythe on Fish Disk 66.
  6.         For a list of improvements over Smythe's program,
  7.          see the end of this file.
  8.  
  9. Distribution:    This program is Freely Distributable.
  10.         Make as many copies as you want.
  11.         Give this program to anybody, without cost.
  12.         Use my source code in any programs of your own.
  13.         (Please give me credit in your program -- thanks!)
  14.  
  15.  
  16.     ----------------------------------------------------------------
  17.  
  18. INTRODUCTION
  19. ------------
  20.  
  21.     This program will display how much free space is remaining
  22. on your disk volumes.  It runs from the CLI only.  The syntax is:
  23.  
  24.     1>  Free [<OPTIONS>] [volume1] [volume2] ... [volumeN]
  25.  
  26.  
  27. HOW TO USE "Free"
  28. ------------------
  29.  
  30. There are three different ways that Free may behave.
  31.  
  32. (1)    You can specify volume names on the command line.  Free will
  33.     display the free space on those volumes only.
  34.  
  35.     Example:
  36.  
  37.         1>  Free df0: df1: RAM:
  38.  
  39.     Of course, you can use the Commodore Shell (or similar shell) to
  40.     define aliases, if you want to see disk space on your favorite
  41.     volumes:
  42.  
  43.         1>  alias floppies Free df0: df1:
  44.         1>  floppies
  45.  
  46. (2)    If you specify NO volume names on the command line, Free will then
  47.     look for an environment variable called FREE_DRIVES.  This is a
  48.     standard Commodore ENV: variable, whose value is set using the
  49.     "setenv" command.
  50.  
  51.     The value of FREE_DRIVES is a list of volumes, separated by
  52.     commas.  There is no whitespace between volumes and commas,
  53.     and each volume must end (as usual) with a colon.  For
  54.     example:
  55.  
  56.         1>  setenv FREE_DRIVES "df0:,df1:,dh0:,dh1:,RAM:,RAD:"
  57.  
  58.     You can put a line like this in your startup-sequence.
  59.  
  60.     REMEMBER:  In order to use environment variables and setenv, you
  61.     must have ENV: assigned somewhere.  (Under AmigaDOS 1.4 and up,
  62.     you must explicitly mount ENV:, I think.)  See your Amiga 
  63.     documentation about ENV: and environment variables.
  64.  
  65. (3)    If you specify no volume names on the command line, and the
  66.     variable FREE_DRIVES does not exist, then Free will check what
  67.     version of the Amiga operating system is running.  Under Amiga OS
  68.     version 2.0 or higher, Free will print the available space on ALL
  69.     disk volumes on your Amiga, plus free RAM.
  70.     
  71.     Under Amiga OS versions earlier than 2.0, Free will use the default
  72.     list of volumes:
  73.  
  74.         RAD:
  75.         DF0:
  76.         DF1:
  77.  
  78.     plus free RAM.  You can change this default list by modifying the
  79.     value of DEFAULT_VOLUMES in the header file of the source code, and
  80.     recompiling.  I see no reason to do this, however, since you can
  81.     use the FREE_DRIVES environment variable or Shell aliases (adding
  82.     command-line arguments) to make an equivalent change without
  83.     recompiling.
  84.  
  85.  
  86. GETTING HELP
  87. ------------
  88.  
  89. Type:
  90.         1>  Free ?
  91.  
  92. for a summary of usage information.
  93.  
  94.  
  95. DISPLAYING FREE MEMORY
  96. ----------------------
  97.  
  98.     If you give the volume name "RAM:" (case doesn't matter), you will
  99. be shown how much free memory you have.  If you have FAST RAM, the number
  100. will be broken up into separate CHIP and FAST amounts, plus a TOTAL.
  101.  
  102. COMMAND-LINE OPTIONS
  103. --------------------
  104.  
  105.     Command-line options always begin with a dash '-'.  You may specify
  106. each option with its own dash, or group several options under each dash.
  107. However, all options must preceed all volume names on the command line.
  108.  
  109.     -b    Give answers in blocks instead of bytes.
  110.  
  111.     -r    Turn on volume requestors (turned off by default).
  112.  
  113.         NOTE:  If you use -r and "ENV:" is not available, you
  114.         will get a requestor asking for ENV:.  This is not a
  115.         bug... but I wanted you to be aware of it.  It's a VERY
  116.         good idea ALWAYS to have ENV: available, since more and
  117.         more programs are going to use it.
  118.  
  119.     -m    [Advanced.]  Allocate memory for the output of Free.
  120.         To speed up screen output, everything is stored in a single
  121.         character array and then written to the screen.
  122.         The default array length is BUFSIZ (1024) bytes.
  123.         You can override this number with "-m BYTES", where BYTES
  124.         is the size of the output array.
  125.  
  126.         I doubt you will ever need to use the -m option, but I
  127.         have included it for completeness.
  128.  
  129.     -l    Specify the maximum length of a volume name (including
  130.         the colon).  Free assumes that all your volume names are
  131.         four characters long (df1:, rad:, etc.) or less.
  132.         Use this option to override this default.
  133.  
  134.         The value you specify must be between 1 and 255, inclusive.
  135.  
  136.     Examples:
  137.  
  138.         1>  Free -r -b dh0:
  139.         1>  Free -br df1: df2:
  140.         1>  Free -m 10000 -rbl 8 df1:
  141.         1>  Free -m10000 -bl8
  142.  
  143.  
  144. ERROR HANDLING
  145. --------------
  146.  
  147.     If you specify a volume name illegally, Free will complain about
  148. it.  For example:
  149.  
  150.         1>  Free df1
  151.  
  152. Since "df1" does not end with a colon (should be df1:), it is not a valid 
  153. volume name.
  154.  
  155.     If you specify a legal volume name, but the volume is not mounted,
  156. then Free will display the volume name with the symbol "--" next to it.
  157. This indicates that a floppy drive has no disk in it, or that a volume is
  158. not mounted.
  159.  
  160.     Example:
  161.  
  162.         1>  Free Nonexistent:
  163.         Nonexistent:     --
  164.  
  165.     Non-existent volumes will not cause any volume requestors to pop up,
  166. since Free turns them off while it runs.  (You can enable volume requestors
  167. with the -r option.)
  168.  
  169.  
  170. LIMITATIONS OF THIS PROGRAM
  171. ---------------------------
  172.  
  173.     The following is a list of limitations on how this program
  174. works, due to the way it was designed.  If you don't like these decisions
  175. that I made, just modify the source code and recompile.  (Honestly, these
  176. are such minor issues that I think nobody will care about them.)
  177.  
  178. 1)    If you specify your volume names using FREE_DRIVES, no device
  179.     name may have a comma in it.  The comma is used as a delimiter
  180.     character for separating volume names.
  181.  
  182.     However, this is a simple problem to get around.  You can ASSIGN
  183.     an alternate name for your volume, or you can specify the volume
  184.     on the command line (where there are no "comma" restrictions).
  185.  
  186. 2)    The "free space" displayed must fit into 10 digits, or else
  187.     the indenting may not be correct.  (You don't have to worry about
  188.     this, unless you have more than 10 Gigabytes of space on a single
  189.     volume!)
  190.  
  191.     If you want to change this limit in the source code, just change
  192.     the value of DEFAULT_SPACING in the file free.h.
  193.  
  194. 3)    Free RAM: space is always in bytes, even if the -b option is
  195.     specified.  "Blocks" makes no sense when you're talking about
  196.     RAM:.
  197.  
  198.  
  199. CHANGES/IMPROVEMENTS OVER TOM SMYTHE'S PROGRAM
  200. ----------------------------------------------
  201.  
  202. o    Does not use self-modifying code, so it should work on
  203.     ALL Amigas, not just 68000-based systems.
  204. o    You can specify a device list on the command line.
  205. o    You can specify a device list using an environment variable.
  206. o    Requestors are turned off, so non-mounted devices are just
  207.     skipped.  (See -r option.)
  208. o    Data is written in correct columns, regardless of the 
  209.     lengths of the volume names.  (See -l option.)
  210. o    Total memory free is shown, along with CHIP and FAST
  211.     subtotals.
  212. o    Command-line options added so the user can customize the
  213.     program.
  214. o    Written in ANSI C, in a modular and easy-to-read style.
  215.  
  216.  
  217. STUPID DISCLAIMER
  218. -----------------
  219.  
  220. Daniel J. Barrett makes no claims about the suitability of this program
  221. for any particular purpose.  Any damages incurred through the use of
  222. this program are entirely the responsibility of the USER.  Use at your
  223. own risk.  So there!   :-)
  224.